﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DishesList.aspx.cs" Inherits="BuXiaChu.OrderDishes.Web.CallCenter.Order.DishesList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link media="screen, projection" rel="stylesheet" type="text/css" href="../css/Blueprint/screen.css" />
    <link media="screen, projection" rel="stylesheet" type="text/css" href="../css/main.css" />
    <script type="text/javascript" src="../js/Extend.js"></script>
    <script type="text/javascript" src="../js/Common.js"></script>
    <script type="text/javascript" src="../js/jquery-vsdoc.js"></script>
</head>
<body onunload="window.opener.window.webPB.close();">
    <div class="container">
        <div>
            <!--餐厅列表-->
            <div class="span-7 boxc" style="height: 320px; overflow: auto;">
                <div id="div_RestaurantList">
                    餐馆数据加载中。。。
                </div>
            </div>
            <!--菜品列表-->
            <div class="span-16 last boxc">
                <div id="div_DishesList" style="height: 300px; overflow: auto;">
                </div>
                <div>
                    <span>餐厅备注：</span><span id="sp_RestaurantRemarks"></span></div>
            </div>
            <!--搜索 开始-->
            <div class="span-24 boxc">
                <div class="span-13">
                    <span>餐厅</span><input type="text" id="txt_RestaurantName" />
                    <span>菜品</span><input type="text" id="txt_DishesName" />
                    <input type="button" id="btn_Search" value="搜索" /></div>
                <div class="span-10">
                    金额：<em id="div_Total"> </em>元
                    <input type="button" id="btn_ConfrimOrder" value="确定订单" />
                    <input type="button" id="btn_CancleOrder" value="取消" /></div>
            </div>
        </div>
        <!--搜索 结束-->
        <div class="span-24 boxc">
            <table id="tbl_SelectedDishes">
                <tr>
                    <td>
                        序号
                    </td>
                    <td>
                        区域
                    </td>
                    <td>
                        餐厅名称
                    </td>
                    <td>
                        菜品名称
                    </td>
                    <td>
                        菜品类别
                    </td>
                    <td>
                        单价
                    </td>
                    <td>
                        单位
                    </td>
                    <td>
                        数量
                    </td>
                    <td>
                        备注
                    </td>
                    <td>
                        操作
                    </td>
                </tr>
            </table>
        </div>
    </div>
</body>
</html>
<script type="text/javascript" src="../js/Order/Order.js"></script>
<script type="text/javascript" src="../js/Highlight.js"></script>
<script type="text/javascript">
    orderManager.totalPrice = function () {
        var cacheList = orderManager.cacheData, total = 0;
        for (var i = 0, len = cacheList.length; i < len; i++) {
            total += cacheList[i].price * cacheList[i].number;
        }
        jDoc("div_Total").innerHTML = total.toFixedString(2);
    };
    (function () {
        var parentArea = window.opener.document.getElementById("sel_Area");
        orderManager.currentAreaId = parentArea.options[parentArea.selectedIndex].value;
        orderManager.currentAreaName = parentArea.options[parentArea.selectedIndex].text;
        $(jDoc("btn_Search")).click(function () {
            jDoc("div_RestaurantList").innerHTML = "餐馆数据加载中...";
            var postData = { t: 1 };
            postData.areaId = orderManager.currentAreaId;
            postData.restaurantName = jDoc("txt_RestaurantName").value;
            postData.dishesName = jDoc("txt_DishesName").value;
            $.post(orderManager.url.getDataList, postData, function (data) {
                if (data.success) {
                    jDoc("div_RestaurantList").innerHTML = data.message;
                } else {
                    jDoc("div_RestaurantList").innerHTML = "数据加载失败";
                }
            }, "json");
        });
        $(jDoc("btn_Search")).click();

        $(jDoc("btn_ConfrimOrder")).click(function () {
            orderManager.setRmarksToCacheData();
            window.opener.window.getSelectDishesList(orderManager.cacheData);
            window.close();
        });
        $(jDoc("btn_CancleOrder")).click(function () {
            orderManager.delAllCacheData();
        });
        orderManager.cacheData = [];
        var parentCacheData = window.opener.window.orderManager.cacheData;
        for (var i = 0, len = parentCacheData.length; i < len; i++) {
            var cacheObj = {};
            Object.extend(cacheObj, parentCacheData[i], true);
            orderManager.addDataToCache(cacheObj);
        }
    })();
</script>
